package com.meetingshow.action.meeting;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.meetingshow.action.MeetingShowAction;
import com.meetingshow.form.meeting.MeetingForm;
import com.meetingshow.service.meeting.IMeetingSVC;
import com.meetingshow.utils.UIServiceFactory;

public class MeetingMgAction extends MeetingShowAction {
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse res)
			throws Exception {
		Logger logger = Logger.getLogger(MeetingMgAction.class);
		logger.info("MeetingMgAction");
		
		HttpSession session = request.getSession();
		
		try {
			MeetingForm meetingForm = (MeetingForm)form;
			IMeetingSVC meetingSVC = UIServiceFactory.getMeetingSVC();
			List meetingList = meetingSVC.getMeetingList(meetingForm.getName(), meetingForm.getName_en(), meetingForm.getStart_date(), meetingForm.getEnd_date(), meetingForm.getType(),
					meetingForm.getDistrict(), meetingForm.getIndustry(), meetingForm.getOrganizer(), 
					meetingForm.getSponsor(), meetingForm.getCharge(), meetingForm.getPopular(), meetingForm.getLevel(), 
					meetingForm.getValue());
			request.setAttribute("meetingList", meetingList);
			System.out.println("Meeting Query Successfully-CONFIRM");
		
		} catch (Exception e) {
			logger.error(e.toString());
			res.getWriter().println(e.toString());
		}
		return mapping.findForward("success");
	}
}
